#[doc = "Register `UART_DMACR` reader"]
pub struct R(crate::R<UART_DMACR_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<UART_DMACR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<UART_DMACR_SPEC>> for R {
    fn from(reader: crate::R<UART_DMACR_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `UART_DMACR` writer"]
pub struct W(crate::W<UART_DMACR_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<UART_DMACR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<UART_DMACR_SPEC>> for W {
    fn from(writer: crate::W<UART_DMACR_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "DMA enable control for the RX channel when the UART error interrupt (UARTEINTR) occurs.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum DMAONERR_A {
    #[doc = "0: The request output (UARTRXDMASREQ or UARRTXDMABREQ) is valid."]
    VALID = 0,
    #[doc = "1: The request output (UARTRXDMASREQ or UARRTXDMABREQ) is invalid."]
    INVALID = 1,
}
impl From<DMAONERR_A> for bool {
    #[inline(always)]
    fn from(variant: DMAONERR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `dmaonerr` reader - DMA enable control for the RX channel when the UART error interrupt (UARTEINTR) occurs."]
pub struct DMAONERR_R(crate::FieldReader<bool, DMAONERR_A>);
impl DMAONERR_R {
    pub(crate) fn new(bits: bool) -> Self {
        DMAONERR_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> DMAONERR_A {
        match self.bits {
            false => DMAONERR_A::VALID,
            true => DMAONERR_A::INVALID,
        }
    }
    #[doc = "Checks if the value of the field is `VALID`"]
    #[inline(always)]
    pub fn is_valid(&self) -> bool {
        **self == DMAONERR_A::VALID
    }
    #[doc = "Checks if the value of the field is `INVALID`"]
    #[inline(always)]
    pub fn is_invalid(&self) -> bool {
        **self == DMAONERR_A::INVALID
    }
}
impl core::ops::Deref for DMAONERR_R {
    type Target = crate::FieldReader<bool, DMAONERR_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `dmaonerr` writer - DMA enable control for the RX channel when the UART error interrupt (UARTEINTR) occurs."]
pub struct DMAONERR_W<'a> {
    w: &'a mut W,
}
impl<'a> DMAONERR_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: DMAONERR_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "The request output (UARTRXDMASREQ or UARRTXDMABREQ) is valid."]
    #[inline(always)]
    pub fn valid(self) -> &'a mut W {
        self.variant(DMAONERR_A::VALID)
    }
    #[doc = "The request output (UARTRXDMASREQ or UARRTXDMABREQ) is invalid."]
    #[inline(always)]
    pub fn invalid(self) -> &'a mut W {
        self.variant(DMAONERR_A::INVALID)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u16) & 0x01) << 2);
        self.w
    }
}
#[doc = "TX FIFO DMA enable.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXDMAE_A {
    #[doc = "0: disabled."]
    DISABLED = 0,
    #[doc = "1: enabled"]
    ENABLED = 1,
}
impl From<TXDMAE_A> for bool {
    #[inline(always)]
    fn from(variant: TXDMAE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `txdmae` reader - TX FIFO DMA enable."]
pub struct TXDMAE_R(crate::FieldReader<bool, TXDMAE_A>);
impl TXDMAE_R {
    pub(crate) fn new(bits: bool) -> Self {
        TXDMAE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> TXDMAE_A {
        match self.bits {
            false => TXDMAE_A::DISABLED,
            true => TXDMAE_A::ENABLED,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLED`"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        **self == TXDMAE_A::DISABLED
    }
    #[doc = "Checks if the value of the field is `ENABLED`"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        **self == TXDMAE_A::ENABLED
    }
}
impl core::ops::Deref for TXDMAE_R {
    type Target = crate::FieldReader<bool, TXDMAE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `txdmae` writer - TX FIFO DMA enable."]
pub struct TXDMAE_W<'a> {
    w: &'a mut W,
}
impl<'a> TXDMAE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: TXDMAE_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "disabled."]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut W {
        self.variant(TXDMAE_A::DISABLED)
    }
    #[doc = "enabled"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut W {
        self.variant(TXDMAE_A::ENABLED)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u16) & 0x01) << 1);
        self.w
    }
}
#[doc = "TX FIFO DMA enable.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RXFIFODMAENABLE_A {
    #[doc = "0: disabled."]
    DISABLED = 0,
    #[doc = "1: enabled"]
    ENABLED = 1,
}
impl From<RXFIFODMAENABLE_A> for bool {
    #[inline(always)]
    fn from(variant: RXFIFODMAENABLE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `RX FIFO DMA enable` reader - TX FIFO DMA enable."]
pub struct RXFIFODMAENABLE_R(crate::FieldReader<bool, RXFIFODMAENABLE_A>);
impl RXFIFODMAENABLE_R {
    pub(crate) fn new(bits: bool) -> Self {
        RXFIFODMAENABLE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RXFIFODMAENABLE_A {
        match self.bits {
            false => RXFIFODMAENABLE_A::DISABLED,
            true => RXFIFODMAENABLE_A::ENABLED,
        }
    }
    #[doc = "Checks if the value of the field is `DISABLED`"]
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        **self == RXFIFODMAENABLE_A::DISABLED
    }
    #[doc = "Checks if the value of the field is `ENABLED`"]
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        **self == RXFIFODMAENABLE_A::ENABLED
    }
}
impl core::ops::Deref for RXFIFODMAENABLE_R {
    type Target = crate::FieldReader<bool, RXFIFODMAENABLE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `RX FIFO DMA enable` writer - TX FIFO DMA enable."]
pub struct RXFIFODMAENABLE_W<'a> {
    w: &'a mut W,
}
impl<'a> RXFIFODMAENABLE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RXFIFODMAENABLE_A) -> &'a mut W {
        self.bit(variant.into())
    }
    #[doc = "disabled."]
    #[inline(always)]
    pub fn disabled(self) -> &'a mut W {
        self.variant(RXFIFODMAENABLE_A::DISABLED)
    }
    #[doc = "enabled"]
    #[inline(always)]
    pub fn enabled(self) -> &'a mut W {
        self.variant(RXFIFODMAENABLE_A::ENABLED)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x01) | ((value as u16) & 0x01);
        self.w
    }
}
impl R {
    #[doc = "Bit 2 - DMA enable control for the RX channel when the UART error interrupt (UARTEINTR) occurs."]
    #[inline(always)]
    pub fn dmaonerr(&self) -> DMAONERR_R {
        DMAONERR_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 1 - TX FIFO DMA enable."]
    #[inline(always)]
    pub fn txdmae(&self) -> TXDMAE_R {
        TXDMAE_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 0 - TX FIFO DMA enable."]
    #[inline(always)]
    pub fn rxfifodmaenable(&self) -> RXFIFODMAENABLE_R {
        RXFIFODMAENABLE_R::new((self.bits & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 2 - DMA enable control for the RX channel when the UART error interrupt (UARTEINTR) occurs."]
    #[inline(always)]
    pub fn dmaonerr(&mut self) -> DMAONERR_W {
        DMAONERR_W { w: self }
    }
    #[doc = "Bit 1 - TX FIFO DMA enable."]
    #[inline(always)]
    pub fn txdmae(&mut self) -> TXDMAE_W {
        TXDMAE_W { w: self }
    }
    #[doc = "Bit 0 - TX FIFO DMA enable."]
    #[inline(always)]
    pub fn rxfifodmaenable(&mut self) -> RXFIFODMAENABLE_W {
        RXFIFODMAENABLE_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "UART_DMACR is the DMA control register.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [uart_dmacr](index.html) module"]
pub struct UART_DMACR_SPEC;
impl crate::RegisterSpec for UART_DMACR_SPEC {
    type Ux = u16;
}
#[doc = "`read()` method returns [uart_dmacr::R](R) reader structure"]
impl crate::Readable for UART_DMACR_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [uart_dmacr::W](W) writer structure"]
impl crate::Writable for UART_DMACR_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets UART_DMACR to value 0"]
impl crate::Resettable for UART_DMACR_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
